import { createHashRouter } from 'react-router-dom'; // 引入路由对象
import Root from './root'; // 路由组件
import ErrorPage from '@/views/error/error';
import Contact from '@/views/contact/contact';
import Home from '@/views/home/home';
import AboutUs from '@/views/gywm/gywm';
import Zhishi from '@/views/zhishi/zhishi';
import Zixun from '@/views/zixun/zixun';
import Article from '@/views/article/article';
import Kuajing from '@/views/kuajing/kuajing';

const router = createHashRouter([
  {
    path: '/',
    element: <Home />,
    errorElement: <ErrorPage />,
    children: [
      {
        path: '',
        element: <AboutUs />,
        errorElement: <ErrorPage />,
      },
      {
        path: 'zhishi',
        element: <Zhishi />,
        errorElement: <ErrorPage />,
      },
      {
        path: 'zixun',
        element: <Zixun />,
        errorElement: <ErrorPage />,
      },
      {
        path: 'article',
        element: <Article />,
        errorElement: <ErrorPage />,
      },
      {
        path: '',
        element: <Kuajing />,
        errorElement: <ErrorPage />,
      },
    ],
  },
  {
    path: '/root',
    element: <Root />,
    errorElement: <ErrorPage />,
    children: [
      {
        path: 'contacts/:contactId',
        element: <Contact />,
        errorElement: <ErrorPage />,
      },
    ],
  },

  // {
  //   path: 'contacts/:contactId',
  //   element: <Contact />,
  //   errorElement:<ErrorPage/>
  // },
]);
export default router;
